<template>
    <div>
        <div style="text-align: center;padding: 10% 0;">
            <p style="color: #fff;font-size: 24px;">修改密码</p>
        </div>
        <form class="container-fluid" style="height: 100%;">
            <div class="form-group">
                <label style="color: #fff;">新密码</label>
                <input v-model="password1" style="color: #00a0e9" type="password" class="form-control" placeholder="">
            </div>
            <div class="form-group">
                <label style="color: #fff;">确认密码</label>
                <input v-model="password2" type="password" class="form-control" placeholder="">

<!--                <div class="input-group">-->
<!--                    <div class="input-group-btn">-->
<!--                        <div class="btn btn-primary" @click="postReset"><img width="20"-->
<!--                                                                            src="../../assets/img/right-white.png">-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
            </div>
        </form>

        <div style="margin-top: 10%;text-align: center">
            <button @click="postReset" style="border: none;background-color: #fff;color: #00a0e9;width: 50%;height: 50px;border-radius: 25px;">修改密码</button>
        </div>
    </div>
</template>
<script>
    import swal from "sweetalert";

    export default {
        data() {
            return {
                password1: '',
                password2: '',
            }
        },
        created() {
        },
        beforeDestroy() {
            document.querySelector('body').setAttribute('style', 'background-color:rgb(249,249,249);');
        },
        mounted() {
            document.querySelector('body').setAttribute('style', 'background-color:#4565b2;');
        },
        methods: {
            postReset() {
                if (this.password1 == '' || this.password2 == '') {
                    return;
                }
                if (this.password1 != this.password2) {
                    swal('密码不一致');
                    return;
                }
                this.api.postReset(this.password1, this.password2).then(res => {
                    swal(res.meta.msg);
                });
            },
        },
    }
</script>
<style>

</style>
